<template>
  <div class="app-container">
    <el-row>
      <el-col :span="24" :xs="24">
        <el-card class="box-card">
          <div slot="header" class="clearfix" style="display: flex">
            <span>个人信息</span>
            <el-button
              style="margin-left: auto"
              @click="passwordDialog = true"
              type="danger"
              size="mini"
              >修改密码</el-button
            >
          </div>
          <div>
            <div class="text-center">
              <userAvatar />
            </div>
            <ul class="list-group list-group-striped">
              <li class="list-group-item">
                <div class="userWid">
                  <svg-icon icon-class="user" class="svg" />用户名称
                </div>
                <div class="pull-right">{{ user.name }}</div>
              </li>
              <li class="list-group-item">
                <div class="userWid">
                  <svg-icon icon-class="phone" class="svg" />手机号码
                </div>
                <div class="pull-right">{{ user.phone }}</div>
              </li>
              <li class="list-group-item">
                <div class="userWid">
                  <svg-icon icon-class="tree" class="svg" />年龄
                </div>
                <div class="pull-right">{{ user.age }}</div>
              </li>
              <li class="list-group-item">
                <div class="userWid">
                  <svg-icon icon-class="peoples" class="svg" />医生简介
                </div>
                <div class="pull-right">{{ user.remark }}</div>
              </li>
              <li class="list-group-item">
                <div><svg-icon icon-class="date" class="svg" />创建日期</div>
                <div class="pull-right">{{ user.createTime }}</div>
              </li>
            </ul>
          </div>
        </el-card>
      </el-col>
    </el-row>
    <el-dialog title="修改密码" :visible.sync="passwordDialog">
      <resetPwd />
    </el-dialog>
  </div>
</template>

<script>
import userAvatar from "./userAvatar";
import userInfo from "./userInfo";
import resetPwd from "./resetPwd";

export default {
  name: "Profile",
  components: { userAvatar, userInfo, resetPwd },
  data() {
    return {
      user: {},
      activeTab: "userinfo",
      passwordDialog: false,
    };
  },
  created() {
    this.getUser();
  },
  methods: {
    showDialog() {
      this.passwordDialog = true;
    },
    getUser() {
      this.user = localStorage.getItem("user")
        ? JSON.parse(localStorage.getItem("user"))
        : {};
    },
  },
};
</script>
